﻿// Copyright (c) Inossem. All rights reserved.
// Licensed under the LGPL-3.0 license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DWF.Studio.NuGetManagement
{
    /// <summary>
    /// nuget包管理器接口
    /// </summary>
    public interface IPackageManager
    {
        /// <summary>
        /// 根据id获取包
        /// </summary>
        /// <param name="Id"></param>
        /// <param name="version"></param>
        /// <returns></returns>
        Task<NuGetPackage> GetPackageByIdAsync(string Id, string version);
        /// <summary>
        /// 根据id获取包
        /// </summary>
        /// <param name="Id"></param>
        /// <param name="version"></param>
        /// <returns></returns>
        Task<NuGetPackageMetadata> GetLocalRoutePackageByIdAsync(string activitiePath);
        /// <summary>
        /// 查询所有包
        /// </summary>
        /// <param name="seachString"></param>
        /// <param name="skip"></param>
        /// <param name="take"></param>
        /// <param name="includePrereleas"></param>
        /// <returns></returns>
        Task<IEnumerable<NuGetPackage>> SearchPackagesAsync(string seachString, int skip, int take, bool includePrereleas = false, bool isInstalled = false);

        /// <summary>
        /// 获取指定包得所有版本
        /// </summary>
        /// <param name="nugetPackage"></param>
        /// <returns></returns>
        Task<List<NuGetPackage>> GetPackagesWithAllVersionAsync(NuGetPackage nugetPackage);

        /// <summary>
        /// 获取指定包得所有版本
        /// </summary>
        /// <param name="nugetPackage"></param>
        /// <returns></returns>
        Task<List<NuGetPackage>> GetPackagesWithAllVersionAsync(string nugetPackageId,bool isDelay=false);

        /// <summary>
        /// 安装指定包
        /// </summary>
        /// <param name="nugetPackage"></param>
        /// <param name="rootPath"></param>
        /// <returns></returns>
        Task<IEnumerable<NuGetPackageDependency>> InstallPackageAsync(NuGetPackage nugetPackage, string installPath);
    }
}
